using log4net;
using log4net.Config;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Reflection;
using System.Threading;
using System.Windows.Forms;
public sealed class frmUsers : Form
{
	private IContainer icontainer_0;
	private Button btnDeleteOperator;
	private Button btnEditOperator;
	private Button btnAddOperator;
	private DataGridView dataGridViewOperator;
	private DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
	private DataGridViewTextBoxColumn UserName;
	private DataGridViewTextBoxColumn UserLogin;
	private DataGridViewTextBoxColumn RightName;
	private ContextMenuStrip contextMenuStripOperator;
	private ToolStripMenuItem miAddOperator;
	private ToolStripMenuItem miEditOperator;
	private ToolStripMenuItem miDeleteOperator;
	private Button btnClose;
	private string[] string_0 = new string[]
	{
		"Level 1",
		"Level 2",
		"Level 3"
	};
	private System.EventHandler eventHandler_0;
    private IContainer components;
	private ILog ilog_0 = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
	public frmUsers()
	{
		this.InitializeComponent();
		System.Drawing.Color backColor = System.Drawing.Color.FromName(MainForm.SystemConfiguration_0.string_15);
		this.BackColor = backColor;
		BasicConfigurator.Configure();
		XmlConfigurator.Configure();
	}
	protected override void Dispose(bool disposing)
	{
		if (disposing && this.icontainer_0 != null)
		{
			this.icontainer_0.Dispose();
		}
		base.Dispose(disposing);
	}
	private void InitializeComponent()
	{
        this.components = new System.ComponentModel.Container();
        System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmUsers));
        this.btnDeleteOperator = new System.Windows.Forms.Button();
        this.btnEditOperator = new System.Windows.Forms.Button();
        this.btnAddOperator = new System.Windows.Forms.Button();
        this.dataGridViewOperator = new System.Windows.Forms.DataGridView();
        this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
        this.UserName = new System.Windows.Forms.DataGridViewTextBoxColumn();
        this.UserLogin = new System.Windows.Forms.DataGridViewTextBoxColumn();
        this.RightName = new System.Windows.Forms.DataGridViewTextBoxColumn();
        this.contextMenuStripOperator = new System.Windows.Forms.ContextMenuStrip(this.components);
        this.miAddOperator = new System.Windows.Forms.ToolStripMenuItem();
        this.miEditOperator = new System.Windows.Forms.ToolStripMenuItem();
        this.miDeleteOperator = new System.Windows.Forms.ToolStripMenuItem();
        this.btnClose = new System.Windows.Forms.Button();
        ((System.ComponentModel.ISupportInitialize)(this.dataGridViewOperator)).BeginInit();
        this.contextMenuStripOperator.SuspendLayout();
        this.SuspendLayout();
        // 
        // btnDeleteOperator
        // 
        resources.ApplyResources(this.btnDeleteOperator, "btnDeleteOperator");
        this.btnDeleteOperator.Name = "btnDeleteOperator";
        this.btnDeleteOperator.UseVisualStyleBackColor = true;
        this.btnDeleteOperator.Click += new System.EventHandler(this.miDeleteOperator_Click);
        // 
        // btnEditOperator
        // 
        resources.ApplyResources(this.btnEditOperator, "btnEditOperator");
        this.btnEditOperator.Name = "btnEditOperator";
        this.btnEditOperator.UseVisualStyleBackColor = true;
        this.btnEditOperator.Click += new System.EventHandler(this.miEditOperator_Click);
        // 
        // btnAddOperator
        // 
        resources.ApplyResources(this.btnAddOperator, "btnAddOperator");
        this.btnAddOperator.Name = "btnAddOperator";
        this.btnAddOperator.UseVisualStyleBackColor = true;
        this.btnAddOperator.Click += new System.EventHandler(this.miAddOperator_Click);
        // 
        // dataGridViewOperator
        // 
        this.dataGridViewOperator.AllowUserToAddRows = false;
        this.dataGridViewOperator.AllowUserToDeleteRows = false;
        this.dataGridViewOperator.AllowUserToResizeRows = false;
        resources.ApplyResources(this.dataGridViewOperator, "dataGridViewOperator");
        this.dataGridViewOperator.BackgroundColor = System.Drawing.Color.White;
        this.dataGridViewOperator.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
        this.dataGridViewOperator.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
        this.dataGridViewOperator.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
            this.dataGridViewTextBoxColumn2,
            this.UserName,
            this.UserLogin,
            this.RightName});
        this.dataGridViewOperator.ContextMenuStrip = this.contextMenuStripOperator;
        this.dataGridViewOperator.Name = "dataGridViewOperator";
        this.dataGridViewOperator.ReadOnly = true;
        this.dataGridViewOperator.RowHeadersVisible = false;
        this.dataGridViewOperator.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
        this.dataGridViewOperator.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridViewOperator_CellDoubleClick);
        this.dataGridViewOperator.CellMouseDown += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dataGridViewOperator_CellMouseDown);
        // 
        // dataGridViewTextBoxColumn2
        // 
        resources.ApplyResources(this.dataGridViewTextBoxColumn2, "dataGridViewTextBoxColumn2");
        this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
        this.dataGridViewTextBoxColumn2.ReadOnly = true;
        // 
        // UserName
        // 
        resources.ApplyResources(this.UserName, "UserName");
        this.UserName.Name = "UserName";
        this.UserName.ReadOnly = true;
        // 
        // UserLogin
        // 
        resources.ApplyResources(this.UserLogin, "UserLogin");
        this.UserLogin.Name = "UserLogin";
        this.UserLogin.ReadOnly = true;
        // 
        // RightName
        // 
        this.RightName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
        resources.ApplyResources(this.RightName, "RightName");
        this.RightName.Name = "RightName";
        this.RightName.ReadOnly = true;
        // 
        // contextMenuStripOperator
        // 
        resources.ApplyResources(this.contextMenuStripOperator, "contextMenuStripOperator");
        this.contextMenuStripOperator.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.miAddOperator,
            this.miEditOperator,
            this.miDeleteOperator});
        this.contextMenuStripOperator.Name = "contextMenuStripOperator";
        // 
        // miAddOperator
        // 
        this.miAddOperator.Name = "miAddOperator";
        resources.ApplyResources(this.miAddOperator, "miAddOperator");
        this.miAddOperator.Click += new System.EventHandler(this.miAddOperator_Click);
        // 
        // miEditOperator
        // 
        this.miEditOperator.Name = "miEditOperator";
        resources.ApplyResources(this.miEditOperator, "miEditOperator");
        this.miEditOperator.Click += new System.EventHandler(this.miEditOperator_Click);
        // 
        // miDeleteOperator
        // 
        this.miDeleteOperator.Name = "miDeleteOperator";
        resources.ApplyResources(this.miDeleteOperator, "miDeleteOperator");
        this.miDeleteOperator.Click += new System.EventHandler(this.miDeleteOperator_Click);
        // 
        // btnClose
        // 
        resources.ApplyResources(this.btnClose, "btnClose");
        this.btnClose.Name = "btnClose";
        this.btnClose.UseVisualStyleBackColor = true;
        this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
        // 
        // frmUsers
        // 
        this.BackColor = System.Drawing.SystemColors.InactiveCaptionText;
        resources.ApplyResources(this, "$this");
        this.Controls.Add(this.btnClose);
        this.Controls.Add(this.btnAddOperator);
        this.Controls.Add(this.btnDeleteOperator);
        this.Controls.Add(this.btnEditOperator);
        this.Controls.Add(this.dataGridViewOperator);
        this.Name = "frmUsers";
        this.Load += new System.EventHandler(this.frmUsers_Load);
        ((System.ComponentModel.ISupportInitialize)(this.dataGridViewOperator)).EndInit();
        this.contextMenuStripOperator.ResumeLayout(false);
        this.ResumeLayout(false);

	}
	public void method_0(System.EventHandler eventHandler_1)
	{
		System.EventHandler eventHandler = this.eventHandler_0;
		System.EventHandler eventHandler2;
		do
		{
			eventHandler2 = eventHandler;
			System.EventHandler value = (System.EventHandler)System.Delegate.Combine(eventHandler2, eventHandler_1);
			eventHandler = System.Threading.Interlocked.CompareExchange<System.EventHandler>(ref this.eventHandler_0, value, eventHandler2);
		}
		while (eventHandler != eventHandler2);
	}
	public void method_1(System.EventHandler eventHandler_1)
	{
		System.EventHandler eventHandler = this.eventHandler_0;
		System.EventHandler eventHandler2;
		do
		{
			eventHandler2 = eventHandler;
			System.EventHandler value = (System.EventHandler)System.Delegate.Remove(eventHandler2, eventHandler_1);
			eventHandler = System.Threading.Interlocked.CompareExchange<System.EventHandler>(ref this.eventHandler_0, value, eventHandler2);
		}
		while (eventHandler != eventHandler2);
	}
	private void frmUsers_Load(object sender, System.EventArgs e)
	{
		this.method_2();
	}
	private void method_2()
	{
		this.dataGridViewOperator.Rows.Clear();
		int num = 0;
        foreach (BO5 gClass in MainForm.SystemConfiguration_0.ExtendCollection_0)
		{
			num++;
			this.dataGridViewOperator.Rows.Add(new object[]
			{
				num.ToString(),
				gClass.method_2(),
				gClass.method_4(),
				this.string_0[gClass.method_8()]
			});
		}
		if (this.dataGridViewOperator.RowCount > 0)
		{
			this.dataGridViewOperator.CurrentCell = this.dataGridViewOperator[0, this.dataGridViewOperator.RowCount - 1];
		}
		this.btnEditOperator.Enabled = (this.btnDeleteOperator.Enabled = (this.miEditOperator.Enabled = (this.miDeleteOperator.Enabled = (this.dataGridViewOperator.RowCount > 0))));
	}
	private void miAddOperator_Click(object sender, System.EventArgs e)
	{
		frmUser frmUser = new frmUser();
		while (frmUser.ShowDialog() == DialogResult.OK)
		{
            if (MainForm.SystemConfiguration_0.ExtendCollection_0.Search1(frmUser.method_2()) != null)
			{
				MessageBox.Show("Đã tồn tại người sử dụng với tên truy cập này.\nHãy nhập tên truy cập khác.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
			}
			else
			{
                BO5 gClass = new BO5();
				gClass.method_1(MainForm.SystemConfiguration_0.int_24++);
				gClass.method_3(frmUser.method_0());
				gClass.method_5(frmUser.method_2());
				gClass.method_7(frmUser.method_4());
				gClass.method_9(frmUser.method_6());
				gClass.method_11(frmUser.method_8());
				if (MainForm.SystemConfiguration_0.method_10(gClass))
				{
					this.method_2();
					this.ilog_0.Info("Add user: " + gClass.method_2());
					break;
				}
				break;
			}
		}
	}
	private void miEditOperator_Click(object sender, System.EventArgs e)
	{
		if (this.dataGridViewOperator.RowCount > 0)
		{
			string text = this.dataGridViewOperator.CurrentRow.Cells["UserLogin"].Value.ToString();
            BO5 gClass = MainForm.SystemConfiguration_0.ExtendCollection_0.Search1(text);
			if (gClass != null)
			{
				frmUser frmUser = new frmUser();
				frmUser.method_1(gClass.method_2());
				frmUser.method_3(gClass.method_4());
				frmUser.method_5(gClass.method_6());
				frmUser.method_7(gClass.method_8());
				frmUser.method_9(gClass.method_10());
				if (gClass == RegisterationInfo.gclass2_0)
				{
					frmUser.method_10(true);
				}
				while (frmUser.ShowDialog() == DialogResult.OK)
				{
                    if (frmUser.method_2() != gClass.method_4() && MainForm.SystemConfiguration_0.ExtendCollection_0.Search1(frmUser.method_2()) != null)
					{
						MessageBox.Show("Đã tồn tại người sử dụng với tên truy cập này.\nHãy nhập tên truy cập khác.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
					}
					else
					{
						if (!MainForm.SystemConfiguration_0.method_11(gClass, frmUser.method_0(), frmUser.method_2(), frmUser.method_4(), frmUser.method_6(), frmUser.method_8()))
						{
							break;
						}
						this.method_2();
						this.ilog_0.Info("Edit user: " + gClass.method_2());
						if (this.eventHandler_0 != null)
						{
							this.eventHandler_0(this, e);
							break;
						}
						break;
					}
				}
			}
		}
	}
	private void miDeleteOperator_Click(object sender, System.EventArgs e)
	{
		if (this.dataGridViewOperator.RowCount > 0)
		{
			string text = this.dataGridViewOperator.CurrentRow.Cells["UserLogin"].Value.ToString();
            BO5 gClass = MainForm.SystemConfiguration_0.ExtendCollection_0.Search1(text);
			if (gClass != null)
			{
				if (gClass == RegisterationInfo.gclass2_0)
				{
					MessageBox.Show("Không thể xóa người sử dụng đang đăng nhập", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
					return;
				}
				if (MessageBox.Show("Bạn có thực sự muốn xóa người sử dụng này?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes && MainForm.SystemConfiguration_0.method_12(gClass))
				{
					this.method_2();
					this.ilog_0.Info("Delete user: " + gClass.method_2());
				}
			}
		}
	}
	private void dataGridViewOperator_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
	{
		if (e.RowIndex >= 0 && e.ColumnIndex >= 0)
		{
			this.miEditOperator_Click(null, null);
		}
	}
	private void dataGridViewOperator_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
	{
		if (e.RowIndex >= 0)
		{
			this.dataGridViewOperator.CurrentCell = this.dataGridViewOperator[0, e.RowIndex];
		}
	}
	private void btnClose_Click(object sender, System.EventArgs e)
	{
		base.Close();
	}
}
